package com.xinjiang.electricpower.timer;

import com.xinjiang.electricpower.service.IClosedLoopPullDataTask;
import com.xinjiang.electricpower.service.IMarketPullDataTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.Duration;
import java.time.Instant;

/**
 * @author zhanghui
 * @date 2023/2/16 15:01
 * @Description 用电信息采集闭环拉取数据任务
 */
@Slf4j
@Service
public class ClosedLoopPullDataTask implements IClosedLoopPullDataTask {


    @Autowired
    private IMarketPullDataTask iMarketPullDataTask;

    @Override
    public void runClosedLoopTaskParam(String startDate, String endDate) {
        Instant start = Instant.now();
        log.info("拉取{}工单数据开始：{}",KettleQuartz.CJ_BH, start);
        //执行拉取营销数据对应的ktr
        iMarketPullDataTask.runTaskParam(startDate,endDate,KettleQuartz.CJ_BH,"kettle/kettle.ktr");
        Instant end = Instant.now();
        log.info("拉取{}工单数据结束：{}",KettleQuartz.CJ_BH, end);
        log.info("拉取{}工单数据，耗时：{} 毫秒",KettleQuartz.CJ_BH, Duration.between(start,end).toMillis());
    }
}
